﻿using Janus.Cores.IOC;
using Microsoft.Practices.Unity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Janus.UI.Expand
{
    public class Register
    {
        /// <summary>
        /// 注册 服务
        /// </summary>
        public static void Init()
        {
            IUnityContainer u = Container.CreateContainer();
            var assemblyInterface = ServiceFactory.LoadServices("*.Services.Interface.dll");
            ServiceFactory.RegisterToProxy(assemblyInterface, u);
            //注册服务
            //var services=
            DependencyResolver.SetResolver(new UnityDependencyResolver(u));
        }


        public static void ToRegiste<T>(T impl)
        {
            IUnityContainer u = Container.CreateContainer();
            //var assemblyInterface = ServiceFactory.LoadServices("*.Services.Interface.dll");
            //ServiceFactory.RegisterToProxy(assemblyInterface, u);
            u.RegisterInstance<T>(impl);
            //注册服务
            //var services=
            DependencyResolver.SetResolver(new UnityDependencyResolver(u));
        }


    }
}